package caiziyou.com.designpattern.flyweight;

public class IntegerDemo {

	public static void main(String[] args) {
		/**
		 * public static Integer valueOf(int i) {
		 *     if (i >= IntegerCache.low && i <= IntegerCache.high)
		 *         return IntegerCache.cache[i + (-IntegerCache.low)];
		 *     return new Integer(i);
		 * }
		 */
		Integer x = Integer.valueOf(127);
		Integer y = Integer.valueOf(127);
		Integer z = new Integer(127);
		Integer l = new Integer(127);
		System.out.println(x==y);//true
		System.out.println(z==l);//false
		System.out.println(z==x);//false
		
	}
}
